package com.hua.array;

import java.util.concurrent.LinkedTransferQueue;

public class ArrayDemo04 {
    public static void main(String[] args) {
        int[] arrary = {1,3,3,45,6,31};
        printArray(arrary);
        System.out.println();

        int[] arr=reverse(arrary);
        printArray(arr);
    }

    public static void printArray(int[] arrays){
        for (int i = 0; i < arrays.length; i++) {
            System.out.print(arrays[i]+" ");
        }


    }
    //反转数组
    public static int[] reverse(int[] arrays){
        int[] result = new int[arrays.length];
        for (int i = 0,j = arrays.length -1; i < arrays.length; i++,j--) {
            result[j] = arrays[i];
        }
        return result;
    }



}
